<template>
    <div>
        <el-card style="border:none !important;border-radius: 12px;box-shadow:none !important">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item :to="{ path: '/' }">个人中心</el-breadcrumb-item>
                <el-breadcrumb-item>
                    <a href="/">素材管理</a>
                </el-breadcrumb-item>
                <el-breadcrumb-item>我的收藏</el-breadcrumb-item>
            </el-breadcrumb>
            <div class="tab-nav-bd">
                <span class="title">我的收藏</span>
            </div>
        </el-card>
        <div class="main-box" style=" margin-top: 20px;">
            <div class="filter filter-hd"><el-input style="max-width: 600px" placeholder="请输入关键词">
                    <template #append>搜索</template>
                </el-input></div>
            <div class="model-content">
                <div class="model-list-box" style="min-height: 607px;">
                    <ul class="fav-model-list">
                        <li v-for="(item, index) in collectList" :key="index">
                            <div class="move-box">
                                <a class="model-a-css model-item-a"
                                    data-material-id="ACI061619712281428" data-tag-id="20297859" data-res-type="1">
                                    <div class="model-img"><img :src="item['product']['full_url']"
                                            :alt="item['product']['title']">
                                    </div>
                                    <div class="model-item-bd f2">
                                        <span class="model-type">{{ item['product']['nav_id'] }}</span>
                                        <span class="model-name" style="margin-left: 6px;"> {{ item['product']['title'] }}</span>
                                    </div>
                                    <div class="model-contrast">
                                        <div class="js-model-del" :data-material-id="item['product']['product_ids']"
                                            @click="productCareClick(item['product_id'])">
                                            <el-icon>
                                                <Delete />
                                            </el-icon>
                                            <span class="balloon-tips">取消收藏</span>
                                        </div>
                                    </div>
                                </a>
                            </div>
                        </li>
                    </ul>
                </div>
                <div class="btm-tips">到底了哦~</div>
            </div>
        </div>
    </div>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { myCollectList } from '../../api/user/index'
import { productCare } from '../../api/home/index'
const collectList = ref([])
//我的收藏
const myList = () => {
    myCollectList({}).then(res => {
        if (res.code == 1) {
            collectList.value = res.data.list
        }
    })
}
//收藏取消收藏
const productCareClick = (id: number) => {
    productCare({ id: id }).then(res => {
        if (res.code == 1) {
            myList()
        }
    })
}
onMounted(()=>{
    myList()
})
</script>
<style scoped>
.tab-nav-bd {
    margin-top: 16px;
}

.tab-nav-bd .title {
    font-size: 18px;
    font-weight: 700;
    color: #1D2129;
    line-height: 26px;
}

/* .model-content {
    height: 100%;
    overflow-y: auto;
    padding-bottom: 80px;
} */
.fav-model-list {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    margin-left: -15px;
    padding: 0 18px 0 24px;
}

.fav-model-list>li {
    position: relative;
    margin: 15px 0 0 15px;
    width: 245px;
}

.fav-model-list>li .model-a-css {
    display: block;
    position: relative;
    width: 100%;
    font-size: 14px;
    color: #1D2129;
    line-height: 22px;
}

.fav-model-list>li .model-a-css .model-img {
    margin-bottom: 4px;
    width: 100%;
    height: 184px;
    background: #E5E6EB;
    border-radius: 12px;
    overflow: hidden;
}

.fav-model-list>li .model-a-css .model-img img {
    width: 100%;
    height: 100%;
    -webkit-transition: all 1s ease-in-out;
    transition: all 1s ease-in-out;
    border-radius: 12px;
}

.fav-model-list>li .model-a-css .model-item-bd {
    height: 22px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.fav-model-list>li .model-a-css .model-type {
    position: relative;
    margin-right: 6px;
}

.fav-model-list>li .model-a-css .model-type::after {
    content: "";
    position: absolute;
    right: -6px;
    top: 4px;
    width: 1px;
    height: 12px;
    background-color: #86909C;
}

.fav-model-list>li .model-contrast {
    display: none;
    position: absolute;
    right: 8px;
    top: 8px;
}

.fav-model-list>li .model-contrast>div {
    position: relative;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, .6);
    border-radius: 6px;
    margin-bottom: 4px;
    color: #fff;
    font-size: 14px;
    line-height: 24px;
    text-align: center;
    cursor: pointer;
    -webkit-transition: left .5s, opacity .2s;
    transition: left .5s, opacity .2s;
}

.fav-model-list>li .model-contrast .balloon-tips {
    display: none;
    position: absolute;
    right: 30px;
    top: 0;
    padding: 0 6px;
    height: 26px;
    line-height: 26px;
    font-size: 12px;
    color: #fff;
    background: rgba(29, 33, 41, .9);
    border-radius: 2px;
    white-space: nowrap;
}

.fav-model-list>li .model-a-css:hover img {
    -webkit-transform: scale(1.1);
    transform: scale(1.1)
}

.fav-model-list>li:hover .model-contrast {
    display: block;
}

.fav-model-list>li .model-contrast .balloon-tips::after {
    content: "";
    border-color: transparent transparent transparent rgba(29, 33, 41, .9);
    border-width: 6px;
    border-style: solid;
    position: absolute;
    top: 6px;
    right: -12px
}

.fav-model-list>li .model-contrast>div:hover .balloon-tips {
    display: block;
    visibility: initial;
    opacity: 1;
    -webkit-transform: scale(1);
    transform: scale(1)
}

.main-box {
    padding: 0 0 20px;
    background: #FFF;
}

.model-list-box {
    min-height: 667px;
}

.main-box .filter-hd {
    padding: 20px 24px 12px;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    border-bottom: 1px solid #F2F3F5;
}

.model-content {
    /* height: 607px; */
    overflow-y: auto;
    padding-bottom: 80px;
    min-height: 607px;
}

.btm-tips {
    margin: 24px 0;
    color: #4e5969;
    text-align: center;
    font-size: 14px;
}
</style>